package backgammon;

import java.awt.Color;
import java.awt.Point;

/**
 * <p>Represents a backgammon piece.</p>
 * @author Jacob Kwitkoski
 * @version 1.0
 */
public class Piece {

    /**
     * <p>The color of the piece.</p>
     */
    private final Color color;

    /**
     * <p>The center point of the piece;
     * used to draw the piece when selected.</p>
     */
    private Point point;

    /**
     * <p>The array index of the currently selected piece.</p>
     */
    private int arrayIndex;

    /**
     * <p>Creates a piece with the specified color.</p>
     * @param pieceColor the color of the piece to create
     * @param index the array index that the piece is on
     */
    public Piece(final Color pieceColor,
                 final int   index) {
        color      = pieceColor;
        arrayIndex = index;
    }

    /**
     * <p>Returns the color of the piece.</p>
     * @return the color of the piece
     */
    public final Color getColor() {
        return color;
    }

    /**
     * <p>.</p>
     * @return the array index of the piece.
     */
    public final int getArrayIndex() {
        return arrayIndex;
    }

    /**
     * <p>.</p>
     * @param index
     */
    public final void setArrayIndex(final int index) {
        arrayIndex = index;
    }

    /**
     *
     * @return the current point of the piece.
     */
    public final Point getPoint() {
        return point;
    }

    /**
     * <p>.</p>
     * @param newPoint the new point of the piece
     */
    public final void setPoint(final Point newPoint) {
        point = newPoint;
    }
}
